<?php

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class ContentResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
                'category_title' => $this->category()->pluck('title')->first(),
//                'structure' => $this->category()->take('structureTitle')
                'structure' => $this->category()->take('structureTitle')
            ] + parent::toArray($request);
    }
}
